#!/bin/sh

# get target device (hint: it's a touchpad), only first result
DEVICE="$(xinput list --name-only | grep ouchpad | head -1)"
echo $DEVICE
# list props and filter after tap to click as well as natural scrolling, exclude redundant default lines
PROPS="$(xinput list-props "$DEVICE" | grep -e "libinput Tapping Enabled" -e "Natural Scrolling" | grep -Fv "Default")"
echo "$PROPS"
exit 1

while read -r line; do
    #echo "... $line ..."
    # get target ID for xinput command, stored inside $PROPS (1 per line)
    ID=$(echo $line | awk -F"[()]" '{ print $2;exit }')
    # finally launch xinput to set prop $ID of $DEVICE to 1
    xinput set-prop "$DEVICE" "$ID" 1
done <<< "$PROPS"
